import GlobalService from '../global/GlobalService'

let instance = null

class Service extends GlobalService {
  constructor() {
    super()
    return instance || this
  }

  static getInstance() {
    if (!instance) {
      instance = new Service()
    }
    return instance
  }

  /**
   * 获取任务列表
   * @param query
   * @returns {Promise<*>}
   */
  getList = async (query = {}) => {
    return this.get(`/rptTimingSz/queryTaskInfoList`, query)
  }

  /**
   * 更新时间
   * @param model
   * @returns {Promise<*>}
   */
  editItem = async (model = {}) => {
    model.tip_day = +model.tip_day
    model.warn_first_day = +model.warn_first_day
    model.warn_second_day = +model.warn_second_day
    return this.post(`/rptTimingSz/updateTime`, model)
  }
}

export default Service.getInstance()
